﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ZHDJ.Data.Models.JoinParty;
using ZHDJ.Data.Models.Org;
using ZHDJ.JoinParty.BLL;

namespace JoinParty.BLL
{
    public class TemplatePage: PageBase
    {
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            if (PartyJoinApplycation == null)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "tip", "errorD(1);", true);
                return;
            }
            if (PartyOrgMember == null)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "tip", "errorD(2);", true);

            }

        }

        public PartyJoinApplycation PartyJoinApplycation
        {
            get
            {
                var dd = Request.QueryString["AppllicationID"];
                if (!string.IsNullOrEmpty(Request.QueryString["AppllicationID"]))
                {
                    var oModel = DB.PartyJoinApplycation.Find(Request.QueryString["AppllicationID"]);
                    if (oModel != null)
                    {
                        return oModel;
                    }
                }
                return null;
            }
        }

        public PartyOrgMember PartyOrgMember
        {
            get
            {
                if (PartyJoinApplycation == null)
                {
                    return null;
                }
                var oModel = DB.PartyOrgMembers.Find(PartyJoinApplycation.LoginID);
                if (oModel != null)
                {
                    return oModel;
                }
                return null;
            }
        }
    }
}